#ifndef ROBOTIDENTIFICATION_H_
#define ROBOTIDENTIFICATION_H_

#include "../cmvision/cmvision.h"

class RobotProject;
class CMVision;
class Robot;
class RobotIdentification
{
	private:
		
		Robot** robotArray;
		CMVision* cmvision;
	
		int* colors; //buffer con RRGGBB de los colores tomados de cmvision
		//int colorsNumber;
		int robotsNumber;
		
		
	public:
		RobotIdentification(Robot** robotArray,int robotsNumber, CMVision* cmvision);
		~RobotIdentification();
		
		inline int getRobotsNumber(){ return this->robotsNumber;}
		Robot** getRobots();
		Robot* getRobot(int index);
		/*
		 * \brief Returns the cmvision index of a color given in int format (0x00RRGGBB)
		 * 
		 * This functions helps the user to easily search for the index of a color obtained
		 * from the robot class.
		 * \param color the color in 0x00RRGGBB format
		 * \return the index of the color in the cmvision class, or -1 if it didnt found it
		 */
		int getColorIndex(int color);
		
		/*
		 * \brief used to recalculate values of colors in int format, from cmvision
		 * 
		 * This method can be used when changes were made in cmvision class, in order to include 
		 * those changes of colors in this class.
		 */
		void updateColors();
	
	private:
	
		CMVision::region* getNearestRegion(CMVision::region* regionRobot, int indexColor, int minArea, int maxArea, int minDist, int maxDist);
		

};
#endif /*ROBOTIDENTIFICATION_H_*/
